#include"epoll.h"
int epollInit(int *epfd){
    *epfd = epoll_create(1);
    ERROR_CHECK(*epfd,-1,"epoll_create");
}
int epollAdd(int epfd,int fd){
    struct epoll_event event;
    event.events=EPOLLIN;
    event.data.fd=fd;
    int ret = epoll_ctl(epfd,EPOLL_CTL_ADD,fd,&event);
    ERROR_CHECK(ret,-1,"epoll_ctl add");
    return 0;
}
int epollDel(int epfd,int netfd){
    int ret = epoll_ctl(epfd, EPOLL_CTL_DEL, netfd, NULL);
    ERROR_CHECK(ret,-1,"epoll_ctl del");
    close(netfd);
    return 0;
}